package cn.tp.ksoft.civil_driver.dialog;

import android.content.Context;
import android.util.SparseArray;
import android.view.View;

import cn.tp.ksoft.civil_driver.R;
import cn.tp.ksoft.civil_driver.bean.CarType;

/**
 * Created by zhusong on 16/5/11.
 */
public class CarTypeDialog extends WheelDialog {
    SparseArray<CarType> mCarTypes;

    public CarTypeDialog(Context context) {
        super(context);
    }

    @Override
    protected void initData() {
        mTitleTv.setText(getContext().getString(R.string.driver_car_type));
        mWheel1.setVisibility(View.VISIBLE);
        mWheel2.setVisibility(View.GONE);
        mWheel3.setVisibility(View.GONE);
        mCarTypes = new SparseArray<>(3);
        mCarTypes.append(0, new CarType(1, "轿车"));
        mCarTypes.append(1, new CarType(2, "商务车"));
        mCarTypes.append(2, new CarType(3, "客车"));
        SparseArray<String> textData = new SparseArray<>();
        textData.put(0, mCarTypes.get(0).getTypeName());
        textData.put(1, mCarTypes.get(1).getTypeName());
        textData.put(2, mCarTypes.get(2).getTypeName());
        mWheelAdapter1.setData(textData);
    }

    @Override
    protected void onPositiveClick() {
        if (null != mCallBack) {
            mCallBack.onPositiveClick(mCarTypes.get(mWheel1.getCurrentItem()));
        }
    }
}
